<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>淄博智慧金融综合服务平台</title>
		<meta name="Keywords" content="金融,金融超市,企业贷款,余姚金融,中小微,贷款,中小微贷款,中小微金融,余姚贷款,余姚中小微,中小微企业" />
		<meta name="Description" content="依托余姚市城市大数据平台，为中小微企业与金融机构搭建的线上线下融资服务平台。金融机构作为“卖家”，在平台上发布融资产品，中小微企业作为“买家”在平台上选购融资产品，金融管理部门负责协调、管理和统计评价工作。" />
		<meta name="renderer" content="webkit" />
		<link rel="shortcut icon" href="favicon.ico" />
		<link rel="stylesheet" href="index/js/layui/css/layui.css" />
		<link rel="stylesheet" href="index/css/style.css" />
		<link rel="stylesheet" href="index/css/finance_customer_details.css" />
	</head>
	<body>
		<div class="container">
			<div id="header" data-page="pageXhjy7"></div>
			<div class="xy-main">
				<div class="xy-main-customer-img">
					<div style="display: flex;">
						<div style="margin-right: 30px;width: 130px;">
							<div>
								<img src="index/img/jrzy.png" width="120px" height="120px" />
							</div>
							<div style="text-align: center;margin-top: 20px;">
								<button type="button" id="gzBtn" class="layui-btn hide">
									<i class="layui-icon">&#xe654;</i> 关注
								</button>
								<button type="button" id="ngzBtn" class="layui-btn hide">
									<i class="layui-icon">&#xe605;</i> 取消关注
								</button>
							</div>
						</div>
						<div class="customer_personal" id="customer_body" style="line-height: 30px;color: #FFFFFF;">
							<script id="customer_data" type="text/x-jsrender">
								<p><span style="font-size: 22px;">{{:jrzyName}}</span> </p>
								<p>所属机构: {{:field}}</p>
								<p>职位: {{:post}}</p>
								<p>金融机构: {{:jrjgname}}</p>
							</script>
						</div>
					</div>
					<div class="xy-main-customer-btn">
						<button type="button" class="layui-btn customer_btn_left" id="toChat">
							向TA咨询
						</button><br />
						<button type="button" class="layui-btn customer_btn_right" id="toQy">
							立即签约
						</button>
					</div>
				</div>
				<div class="xy-position" style="background-color: #FFFFFF;border-bottom: 1px solid #EAEAEA;">
				</div>
				<div class="xqsx_grzl_body" style="padding: 0 7.2%;">
					<div>
						<div class="xqsx_grzl_body_item">
							<div class="xqsx_grzl_body_item_tit">
								<span style="margin-right: 5px;color: #006fca;font-weight: bold;float: left;">|</span>个人简介
							</div>
							<div class="xqsx_grzl_body_item_body" id="grjj">
							</div>
						</div>
						<div class="xqsx_grzl_body_item">
							<div class="xqsx_grzl_body_item_tit">
								<span style="margin-right: 5px;color: #006fca;font-weight: bold;float: left;">|</span>工作经历
							</div>
							<div class="xqsx_grzl_body_item_body" id="grjl">
								<script type="text/x-jsrender" id="jldata">
									<div style="margin-bottom: 20px;">
										{{:introduction}}
									</div>
									<div style="line-height: 30px;">
										<p>{{:startTime}} - {{:endTime}}</p>
										<P>{{:companyName}} {{:duty}}</P>
									</div>
									
								</script>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div id="footer" style="height: 600px;">
		</div>
		<script src="index/js/jquery.js"></script>
		<script src="index/js/jsrender.js"></script>
		<script src="index/js/layui/layui.js"></script>
		<script src="index/js/loading.js"></script>
		<script src="index/js/sdk.js"></script>
		<script src="index/js/move_port.js"></script>
		<script src="index/js/core.js"></script>
		<script>
			layui.use(['layer', 'form', 'laypage'], function() {
				var layer = layui.layer;
				var form = layui.form;
				var laypage = layui.laypage;
				var params = sdk.getURLVar('id');
				getLoginState();
				// 获取登录状态
				function getLoginState() {
					$.ajax({
						type: 'post',
						dataType: 'json',
						url: sdk.baseIP + 'zxw/company/login/getLoginFlag',
						success: function(data) {
							var userName = data.userName;
							var typeId = data.userType;
							getDet(userName);
							// 签约
							$('#toQy').click(function() {
								if (typeId == '4') {
									if (params) {
										location.href = sdk.baseIP + 'zxw/company/jrzy/jrzy_qy?jrzyId=' + params;
									}
								} else {
									if (data.loginFlag == 'false') {
										layer.msg('您未登录,请先登录.', {
											icon: 5,
											closeBtn: 1,
											time: 1000
										}, function() {
											renderWin(typeId);
										});
									} else if (typeId != '4') {
										layer.msg('只有企业才可以操作.', {
											icon: 5,
											closeBtn: 1,
											time: 3000
										});
									}
								}
							});
							// 咨询
							$('#toChat').click(function() {
								if (typeId == '4') {
									if (params) {
										location.href = sdk.baseIP + 'zxw/company/jrzy/my_chart?jrzyId=' + params;
									}
								} else {
									if (data.loginFlag == 'false') {
										layer.msg('您未登录,请先登录.', {
											icon: 5,
											closeBtn: 1,
											time: 1000
										}, function() {
											renderWin(typeId);
										});
									} else if (typeId != '4') {
										layer.msg('只有企业才可以操作.', {
											icon: 5,
											closeBtn: 1,
											time: 3000
										});
									}
								}
							});
						}
					})
				}
				// 更换验证码
				function changeValidateImg() {
					$('#imgYzm').attr('src', '').attr('src', sdk.baseIP + 'zxw/company/login/getRandomValidateCode?r=' + Math.random());
					form.val("formVcyk", {
						validateCode: ''
					});
				}
				// 渲染登录弹窗
				function renderWin(typeId) {
					$.ajax({
						url: 'login2.html',
						dataType: 'html',
						success: function(html) {
							$('body').append(html);
							$('#bklwxo').text("企业用户");
							$('#getkdh').attr('href', sdk.saIP + 'mh/register.html');
							$('#xhpoee').attr('href', sdk.baseIP + 'zxw/company/qy/forget_pwd');
							$('#xhpoee1').attr('href', sdk.baseIP + 'zxw/company/qy/forget_username');
							layer.open({
								type: 1,
								title: false,
								shadeClose: true,
								content: $('#layerVcyk'),
								success: function(layero, index) {
									changeValidateImg();
									$('#imgYzm').click(function() {
										changeValidateImg()
									});
									form.on('submit(formGohk)', function(d) {
										var rjzpIndex = layer.load(2);
										var data = d.field;
										console.log(data);
										debugger
										var acc = data.account;
										var psw = data.password;
										data.account = btoa(acc);
										data.password = btoa(psw);
										data.typeId = '4';
										setTimeout(function() {
											layer.close(rjzpIndex);
										}, 5000)
										$.ajax({
											type: 'post',
											data: data,
											url: sdk.baseIP + 'zxw/company/login/loginCheck',
											success: function(d) {
												layer.close(rjzpIndex);
												switch (d.code) {
													case '00':
														layer.close(index);
														layer.msg('登录成功', {
															icon: 6,
															closeBtn: 1,
															time: 3000
														});
														window.location.reload();
														break;
													case '03':
														changeValidateImg();
														layer.msg(d.loginFrozenInfo, {
															icon: 5,
															closeBtn: 1,
															time: 3000
														});
														break;
													case '05':
														changeValidateImg();
														layer.msg(d.loginFrozenInfo, {
															icon: 5,
															closeBtn: 1,
															time: 3000
														});
														break;
													case '06':
														changeValidateImg();
														layer.msg(d.loginFrozenInfo, {
															icon: 5,
															closeBtn: 1,
															time: 3000
														});
														break;
													default:
														changeValidateImg();
														layer.msg(d.msg, {
															icon: 5,
															closeBtn: 1,
															time: 3000
														});
														break;
												}
											}
										});
									});
								},
								end: function() {
									form.val("formVcyk", {
										account: '',
										password: '',
										validateCode: ''
									});
								}
							});
						}
					});
				}
				// 获取金融专员详情
				function getDet(user) {
					$.ajax({
						type: 'post',
						data: {
							id: params,
							gz: user
						},
						url: sdk.baseIP + 'mh/app/v2/jrzy/getJrzyOne',
						dataType: 'json',
						success: function(data) {
							console.log(data);
							var gz = data.jrzy.gz;
							$('#customer_body').html($.templates('#customer_data').render(data.jrzy));
							$('#grjj').html(data.jrzy.info);
							$('#grjl').html($.templates('#jldata').render(data.experience));
							// 是否关注
							if(gz != '0'){
								$('#gzBtn').show();
							}else{
								$('#ngzBtn').show();
							}
							$('#gzBtn').click(function() {
								var e = this;
								isGz(params, e);
							});
							$('#ngzBtn').click(function() {
								var e = this;
								notGz(params, e);
							});
						}
					});
				}
				// 关注
				function isGz(jrzyId, e) {
					$.ajax({
						type: 'post',
						data: {
							jrzyId: jrzyId
						},
						url: sdk.baseIP + 'zxw/company/jrzy/addgz',
						dataType: 'json',
						success: function(data) {
							console.log(data);
							if (data.code == '00') {
								$(e).hide();
								$('#ngzBtn').show();
								layer.msg('关注成功!', {
									icon: 6,
									closeBtn: 1,
									time: 3000
								});
							} else {
								layer.msg(data.msg, {
									icon: 5,
									closeBtn: 1,
									time: 3000
								});
							}

						}
					});
				}
				//取消关注
				function notGz(jrzyId, e) {
					$.ajax({
						type: 'post',
						data: {
							jrzyId: jrzyId
						},
						url: sdk.baseIP + 'zxw/company/jrzy/delgz',
						dataType: 'json',
						success: function(data) {
							console.log(data);
							if (data.code == '00') {
								$(e).hide();
								$('#gzBtn').show();
								layer.msg('取消关注', {
									icon: 5,
									closeBtn: 1,
									time: 3000
								});
							} else {
								layer.msg(data.msg, {
									icon: 5,
									closeBtn: 1,
									time: 3000
								});
							}
						}
					})
				}
			});
		</script>
	</body>
</html>
